;(function($){
    function renderCarts(){
        let data = JSON.parse(localStorage.getItem("cartsData"));
        if(data == null){
            return;
        }else{
            let html = "";
            data.forEach((item, index) => {
                let _arr = `<li>
                                <div class="img">
                                    <img src="${item.data.cover}">
                                </div>
                                <div class="content">
                                    <span>${item.data.project_name}</span>
                                </div>
                                <div class="selector">
                                    <span class="cotBtn">-</span>
                                    <span>${item.count}</span>
                                    <span class="cotBtn">+</span>
                                    <span></span>
                                </div>
                            </li>`;
                html += _arr;
            });

            $(".shop ul").html(html);
        }
            
    }

    renderCarts();

    $(document).ready(function () {

        if(location.href.indexOf("#reloaded")==-1){
           location.href=location.href+"#reloaded";
           location.reload();
       }
    })
   

})(jQuery);